<script type="text/javascript">
function passSubmit(){
	$("#newPassAgainMsg").html("");
	$("#newPassMsg").html("");
	validInfo = true;
	
	if ($("#newPass").val() == ""){
		$("#newPassMsg").html("(Nhập password mới)");
		validInfo = false;
	}
	if ($("#newPass").val() != $("#confirmPass").val()){
		$("#newPassAgainMsg").html("(Password mới không trùng khớp)");
		validInfo = false;
	}
	
	if (validInfo == true){
		$("#hidNewPass").val($("#newPass").val());
		$("#hidOldPass").val($("#oldPass").val());
		return $("#main_form").submit();
	}
}

function backToHome(){
	$("#main_form").prop('action', '/it_center/Users/userHome');
	return $("#main_form").submit();
}

</script>

<form id="main_form" action="change_password" method="post">	
	<input type="hidden" name="oldPass" id="hidOldPass"/>
	<input type="hidden" name="newPass" id="hidNewPass"/>
</form>

<section id="content">
<center><H1>Thay đổi password</H1></center>"
	<div>
		<table id="edit_table">
			<tr>
				<td class="edit_column" width="170">
					Nhập password cũ
				</td>
				<td style="text-align: left;">
					<input type="password" id="oldPass"/>
					<br/>
					<span id="oldPassMsg" class="errMsg">
						<?php if ($inform == "Fail"){
							echo "(Password cũ không đúng)";
						}?>
					</span>
				</td>
			</tr>
			<tr>
				<td class="edit_column">
					Nhập password mới
				</td>
				<td style="text-align: left;">
					<input type="password" id="newPass"/>
					<br/>
					<span id="newPassMsg" class="errMsg"></span>
				</td>
			</tr>
			<tr>
				<td class="edit_column"">
					Nhập lại password mới
				</td>
				<td style="text-align: left;">
					<input type="password" id="confirmPass"/>
					<br/>
					<span id="newPassAgainMsg" class="errMsg"></span>
				</td>
			</tr>
			<tr>
				<td colspan="2" style="text-align: center;">
					<button type="button" onclick="passSubmit()">Hoàn Tất</button>
					<button type="button" onclick="backToHome()">Quay Lại</button>
				</td>
			</tr>
		</table>
	</div>
	<span id="inform">
		<?php if ($inform != NULL){
			echo "<center><p>Thay đổi password thành công!!!</p></center>";
		}
		?>
	</span>
</section>